package library;

import library.entity.Book;
import library.entity.BookingRecord;

/**
 * Created by Cheung Chun Hung on 2014/3/11.
 */
public class ErrorMessage {
    ErrorCode errorCode;
    BookingRecord borrowRecord;
    Book book;
    Exception exception;
    public ErrorMessage(ErrorCode errorCode){
        this.errorCode = errorCode;
    }

    public ErrorMessage(ErrorCode errorCode, BookingRecord errorRecord){
        this.errorCode = errorCode;
        borrowRecord = errorRecord;
    }

    public ErrorMessage(ErrorCode errorCode, Exception exception) {
        this.errorCode = errorCode;
        this.exception = exception;
    }
    
    public ErrorMessage(ErrorCode errorCode, Book book) {
        this.errorCode = errorCode;
        this.book = book;
    }

    public String getErrorMessage(){
        return this.errorCode.getDescription();
    }

    public Exception getException(){
        return exception;
    }

    public ErrorCode getErrorCode(){
        return this.errorCode;
    }
    
    public Book getBook(){
    	return this.book;
    }

    public BookingRecord getErrorRecord() { return this.borrowRecord; }
}
